/*
 * Copyright 2004-2005 asoft
 * 本软件及其所有拷贝的名称，与光盘上或本软件中注明的公司同在。
 * 本软件及文档享有版权，并受国家版权法及国际协约条款的保护。
 * 您不可以从本软件中去掉其版权声明；并保证为本软件的拷贝（本部或部分）* 复制版权声明。
 * 您同意制止以任何形式非法拷贝本软件及文档。
 * 版权信息参见：
 *      http://www.asoft.cn/licenses
 */

package com.asoft.examonline.exammanager.view.foreveryone;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import com.asoft.common.base.model.BaseObject;
import com.asoft.common.base.web.view.AddFuncButton;
import com.asoft.common.base.web.view.BaseObjectListTemplet;
import com.asoft.common.base.web.view.ConfigColumnFuncButton;
import com.asoft.common.base.web.view.DelFuncButton;
import com.asoft.common.base.web.view.ExportFuncButton;
import com.asoft.common.base.web.view.FuncButton;
import com.asoft.common.base.web.view.FuncItem;
import com.asoft.common.base.web.view.Item;
import com.asoft.common.base.web.view.Item4CheckBox;
import com.asoft.common.base.web.view.Item4HtmlPreview;
import com.asoft.common.base.web.view.PrintFuncButton;
import com.asoft.common.base.web.view.QueryFuncButton;
import com.asoft.common.base.web.view.Title;
import com.asoft.common.base.web.view.Title4CheckBox;
import com.asoft.common.base.web.view.Title4Sort;
import com.asoft.common.base.web.view.UpdateFuncButton;
import com.asoft.examonline.exammanager.model.ExamQuestion;

/**
 * <p>Title: 试题结果列表</p>
 * <p>Description:
 *   /--功能按钮--/  /--功能切换区--/ <br>
 *   /--       记录标题区       --/<br>
 *   /--       记录列表        --/<br>
 * </p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: asoft</p>
 * @ $Author: author $
 * @ $Date: 2005/02/16 01:04:14 $
 * @ $Revision: 1.7 $
 * @ created in 2005-11-14
 *
 */

public class ExamQuestionList4EveryOne extends BaseObjectListTemplet
{
        static Logger logger = Logger.getLogger(ExamQuestionList4EveryOne.class);

        /** 功能按钮区 */
        public List getButtons(String contextPath)
        {
               List<FuncButton> fbs = new ArrayList<FuncButton>();
               // new Add、Update、Del、Query、Print、COnfigColumnFuncButton(onclick事件函数名) (按钮显示文本,onclick事件函数名)
               fbs.add(new AddFuncButton());
               fbs.add(new UpdateFuncButton());
               fbs.add(new DelFuncButton());
               fbs.add(new QueryFuncButton());
               fbs.add(new ExportFuncButton());
               fbs.add(new PrintFuncButton());
               fbs.add(new ConfigColumnFuncButton());
               return fbs;
        }

        /** 功能切换区 */
        public List getChanges(String contextPath)
        {
               List<FuncItem> fis = new ArrayList<FuncItem>();
               // new FuncItem(功能切换名,是否聚焦,onclick对应函数名);
               fis.add(new FuncItem("试题"));
               return fis;
        }

        /** 明细标题区 */
        public List getTitles(String contextPath)
        {
                List<Title> titles = new ArrayList<Title>();
                // 当前页所有model全选
                titles.add(new Title4CheckBox());
                titles.add(new Title4Sort("编号","eq.code"));
                titles.add(new Title("知识点"));
                titles.add(new Title("题目"));
                titles.add(new Title("答案"));
                titles.add(new Title("解析"));   
                titles.add(new Title4Sort("科目","eq.questType.superType.pri"));
                titles.add(new Title4Sort("题目类型","eq.questType.pri"));
                titles.add(new Title4Sort("难度","eq.difficulty.pri"));
                titles.add(new Title4Sort("来源","eq.source.pri"));
                titles.add(new Title4Sort("编者","eq.authorName"));                
                return titles;
        }

        /** 明细区 */
        public List getItems(String contextPath,BaseObject model)
        {
                ExamQuestion examQuestion = (ExamQuestion)model;
                List<Item> items = new ArrayList<Item>();
                // 本model选择框;
                items.add(new Item4CheckBox(examQuestion.getId()));
                items.add(new Item(examQuestion.getCode()).setLength(examQuestion.getCode().length()*3/7));
                items.add(new Item4HtmlPreview(examQuestion.getKnowledgePoints4Html()));
                items.add(new Item4HtmlPreview(examQuestion.getContent()));
                items.add(new Item4HtmlPreview(examQuestion.getResults4Html()));
                items.add(new Item4HtmlPreview(examQuestion.getResolution()));
                items.add(new Item(examQuestion.getQuestType().getSuperType().getName()));
                items.add(new Item(examQuestion.getQuestType().getName()));
                items.add(new Item(examQuestion.getDifficulty().getName()));
                items.add(new Item(examQuestion.getSource().getName()));
                items.add(new Item(examQuestion.getAuthorName()));
                return items;
        }
}
